package c.h.a.k0.a;

import android.content.Context;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import c.h.a.m0.h;
import c.h.a.y.a;
import com.liuzh.deviceinfo.tests.TestesActivity;

/* compiled from: LoudSpeakerTestFragment */
public class d0 extends a {
    public MediaPlayer W;
    public View X;

    public void D(Context context) {
        super.D(context);
        ((TestesActivity) context).setTitle(2131690056);
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        MediaPlayer mediaPlayer = new MediaPlayer();
        this.W = mediaPlayer;
        if (mediaPlayer != null && !m0()) {
            try {
                if (!this.W.isPlaying()) {
                    this.W.setDataSource(Z(), RingtoneManager.getDefaultUri(1));
                    this.W.prepare();
                }
            } catch (Exception unused) {
            }
        }
    }

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        if (this.X == null) {
            View inflate = layoutInflater.inflate(2131493072, viewGroup, false);
            this.X = inflate;
            ImageView imageView = (ImageView) inflate.findViewById(2131296633);
            if (s().getConfiguration().orientation == 2) {
                imageView.setTranslationY((float) (-h.t(40.0f, s().getDisplayMetrics())));
            }
            imageView.setImageResource(2131231122);
            ((TextView) this.X.findViewById(2131296715)).setText(2131690057);
            this.X.findViewById(2131296650).setOnClickListener(new o(this));
            this.X.findViewById(2131296653).setOnClickListener(new p(this));
        }
        return this.X;
    }

    public void H() {
        this.E = true;
        MediaPlayer mediaPlayer = this.W;
        if (mediaPlayer != null) {
            mediaPlayer.stop();
            this.W.release();
            this.W = null;
        }
    }

    public void N() {
        this.E = true;
        MediaPlayer mediaPlayer = this.W;
        if (mediaPlayer != null) {
            try {
                mediaPlayer.pause();
            } catch (Exception unused) {
            }
        }
    }

    public void P() {
        this.E = true;
        MediaPlayer mediaPlayer = this.W;
        if (mediaPlayer != null) {
            try {
                mediaPlayer.start();
            } catch (Exception unused) {
            }
        }
    }
}
